package com.android.test.activity;

import android.content.Context;
import android.content.SharedPreferences;

public class ProfilePreference {
	private String NAME_USER_FILE = "ProspectProfile";
	public static final String COLUMN_USERNAME = "UserName"; 
	public static final String COLUMN_NICKNAME = "NickName"; 
	public static final String COLUMN_NAME_SCHOOLE = "SchoolName";
	public static final String COLUMN_NAME_GRADE = "GradeName"; 
	private Context mContext = null;
	public ProfilePreference(Context con){
		mContext = con;
	}
	
	public String getValueByKey(String key){
		final SharedPreferences sp = mContext.getSharedPreferences(NAME_USER_FILE, 0);
		String sValue = sp.getString(key, "");
		return sValue;
	}
	
	public boolean SetValueByKey(String key, String sValue ) {
		SharedPreferences sp = mContext.getSharedPreferences(NAME_USER_FILE, 0);
		SharedPreferences.Editor editor = sp.edit(); 
		boolean bR = false;
		sValue = (sValue != null) ? sValue : "";
		editor.putString(key, sValue);
		bR = editor.commit();
		return bR;
	}
}
